package us.codecraft.webmagic.pipeline;

import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.model.BaseDO;

import java.util.ArrayList;
import java.util.List;

/**
 * @author code4crafter@gmail.com
 * @since 0.4.0
 */
public class ResultItemsCollectorPipeline implements CollectorPipeline<BaseDO> {

    private List<BaseDO> collector = new ArrayList();

    @Override
    public synchronized void process(BaseDO baseDO, Task task) {
        collector.add(baseDO);
    }

    @Override
    public List<BaseDO> getCollected() {
        return collector;
    }
}
